package com.xuecheng.content.feignclient;

import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Description 课程索引发生 熔断降级后的执行
 * @Author dingchunlin
 * @Date 2024/4/10 11:45
 * @Version 1.0.0
 */
@Component
@Slf4j
public class SearchServiceClientFallbackFactory implements FallbackFactory<SearchServiceClient> {
    @Override
    public SearchServiceClient create(Throwable throwable) {
        return new SearchServiceClient(){
            @Override
            public Boolean add(CourseIndex courseIndex) {
                log.error("添加课程索引发生熔断：{},熔断异常：{}",courseIndex,throwable);
                return false;
            }
        };
    }
}
